<?php

require_once 'phpmoko/ui/Form/FormBase.php';

class TextArea extends FormBase
{
	private $rows = -1;
	private $cols = 80;
	private $value = null;

	function __construct()
	{
		parent::__construct();
	}

	function setRows($rows)
	{
		$this->rows = $rows;
	}

	function setCols($cols)
	{
		$this->cols = $cols;
	}

	function setValue($value)
	{
		$this->value = $value;
	}

	function toString()
	{
		$str = '<textarea';

		if ($this->id != null)
			$str .= ' id="'.$this->id.'"';

		if ($this->name != null)
			$str .= ' name="'.$this->name.'"';

		if ($this->style != null)
			$str .= ' class="'.$this->style.'"';

		if ($this->cols != -1)
			$str .= ' cols="'.$this->cols.'"';

		if ($this->rows != -1)
			$str .= ' rows="'.$this->rows.'"';

		if ($this->getWidth() != null)
			$str .= ' style="width: '.$this->getWidth().'"';

		$str .= '>';

		if ($this->value != null)
			$str .= htmlspecialchars($this->value);

		$str .= '</textarea>';
			
		return $str;
	}
}
?>